package com.xinlianshiye.im.dao.custom;

import com.xinlianshiye.im.response.UserRecordlist;
import com.xinlianshiye.im.bean.Record;
import com.xinlianshiye.im.response.Page;

import java.time.LocalDate;
import java.util.List;

/**
 * @Author zw
 * @Description 好友聊天记录表
 * @Date 14:25 2019/8/13
 * @Param
 **/
public interface RecordDaoCustom {
    /**
     * @Author zw
     * @Description 根据用户id 查询聊天记录 根据是否读取过 排序 未读取优先级高  好友分组 取最新一条数据  有几条未查阅的信息
     * @Date 14:26 2019/8/13
     * @Param
     **/
    Page<UserRecordlist> findUseridRecordCustom(Integer userid, String search);

    Integer count(Integer sender, Integer receiver);

    /**
     * @Author zw
     * @Description 获取当前聊天对象的未读取的消息
     * @Date 20:25 2019/8/13
     * @Param
     **/
    List<Record> findAllUnRead(Integer userId, Integer other);

    /**
     * 读取消息 将消息变为已读并返回读取的消息数量
     */
    Integer readRecord(Integer ownerId, Integer otherId);

    List<LocalDate> findDurationDate(Integer ownerId, Integer otherId);

    Page<Record> page(Integer ownerId, Integer otherId, String keyword, LocalDate startDate, Integer start, Integer limit);
}
